App({
  onShow: function(res) {
    this.giftPaper(res);
  },
  giftPaper(res) {
    var that = this;
    if (that.globalData.isGiftPaper) {
      if (res && res['query'] && res['query']['canshu'] && res['query']['dt'] && res['query']['openid']) {
        let equipment_no = res['query']['canshu'];
        let dt = res['query']['dt'];
        let chuzhi_openid = res['query']['openid'];
        wx.request({
          url: 'https://api.xlqzh.com/xiaochengxu/chuzhi.aspx',
          data: {
            openid: chuzhi_openid,
            sbh: equipment_no,
            name: 'xyx',
            pass: 'xyx',
            dongzuo: 'put',
            dt: dt
          },
          header: {
            'content-type': 'application/json'
          },
          method: 'POST',
          dataType: 'json',
          success: (result) => {
            console.log(result);
            if (result && result.data == 'ok') {
              wx.showToast({
                title: '出纸成功',
                duration: 1500,
              });
            } else {
              wx.showToast({
                title: '出纸失败',
                icon: 'none',
                duration: 1500,
              });
            }
          },
        });
        that.globalData.isGiftPaper = false;
      }
    }
  },
  globalData: {
    version: '2.0.3',
    isGiftPaper: true,
    userInfo: null,
    url: 'https://xcx.nanxuncn.com/api/dati/naoli/'
  }
})